-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: HELP: Error: The terraform-provider-mongodbatlas_v1.11.0 plugin crashed #1419
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, agree with the next steps 👍
@@ -515,8 +514,11 @@ func expandAlertConfigurationMatchers(d *schema.ResourceData) []matlas.Matcher { | |||
|
|||
if m, ok := d.GetOk("matcher"); ok { | |||
for _, value := range m.([]interface{}) { | |||
v := value.(map[string]interface{}) | |||
if value == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we do something similar to
if ok, v := value.(map[string]interface{}); !ok {
break
}
if vL[0] == nil { | ||
return nil | ||
} | ||
|
||
v := vL[0].(map[string]interface{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as here. I have not fully tried myself, but was wondering if something like ok, v := value.(map[string]interface{}); !ok
would catch the impossibility to cast due to nil.
I also don't fully understand this one: in which cases would there be an array of length > 0 whose first value is nil? And why do we assume that all other values in the array will also be nil?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I tried to do it but the ok
was still true but I am not 100% sure now 🤦 . I will add an update in a few minutes to see if this would work. Thanks for flagging this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, We can use the ok,v
pattern here. I opened #1420 to address this comment. Thanks
Description
This PR fixes an NPE when the matcher & metrics threshold are provided with null fields
Link to any related issue(s): #1396
Type of change:
Required Checklist:
Further comments
Next Steps: